<?php
class SfNotice {
    static public function push($err_string) {
        @session_start();
        if (!isset($_SESSION['sfnotice'])) {
            $_SESSION['sfnotice']=array();
        }
        if (!in_array($err_string,$_SESSION['sfnotice'])) {
            $_SESSION['sfnotice'][]=$err_string;
        }
    }
    static public function display($keep=false) {
        @session_start();
        if (!empty($_SESSION['sfnotice'])) {
            echo '<ul class="sfnotice">';
            foreach ($_SESSION['sfnotice'] as $err) {
                echo '<li>',$err,'</li>';
				echo $err;
            }
            echo '</ul>';
        }
        if (!$keep) {
            self::clear();
        }
    }
    static public function clear() {
        $_SESSION['sfnotice']=array();
    }
}
